home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 316 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c,comp.std.c
  4. Subject: Re: Integral conversion e.t.c. (was: Re: Hungarian notation)
  5. Date: Wed, 07 Feb 96 12:34:11 GMT
  6. Organization: none
  7. Message-ID: <823696451snz@genesis.demon.co.uk>
  8. References: <30C40F77.53B5@swsbbs.com> <SPENCER.96Jan22113215@zorgon.ERA.COM> <TANMOY.96Feb2110443@qcd.lanl.gov>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <TANMOY.96Feb2110443@qcd.lanl.gov>
  15.            tanmoy@qcd.lanl.gov "Tanmoy Bhattacharya" writes:
  16.  
  17. >C does have implementation defined behaviour too. For example, whether
  18. >char is signed or unsigned is implementation defined. The
  19. >implementation documentation has to specify the choices made for the
  20. >implementation defined behaviours.  The standard very clearly
  21. >distinguishes between implementation defined and undefined behaviour,
  22. >and only very rarely, as in (int)(char*)0, allows an implementation to
  23. >define something as undefined (This seems to be the majority view
  24. >here: claims have been made that implementation always has the right).
  25.  
  26. "3.10 implementation-defined behaviour: Behaviour, for a correct program
  27.  construct and correct data, that depends on the characteristics of the
  28.  implementation and that each implementation shall document"
  29.  
  30. If a correct program construct and correct data can result in undefined
  31. behaviour then the whole basis of C is severely flawed. There is no way
  32. that implementation-defined behaviour can sensibly be allowed to be
  33. undefined behaviour (and there is nothing in the standard that supports
  34. this view). In the case of (int)(char*)0 the standard (6.3.4) states the
  35. conditions where the behaviour is undefined; it does not allow the
  36. implementation to specify 'undefined' as a form of implementation-defined
  37. behaviour. The implementation can/must state the size of integer required
  38. hold a pointer (which can be none suitable) but it is still the standard
  39. which states, based on that information, whether a particular
  40. pointer->integer conversion results in undefined behaviour.
  41.  
  42. -- 
  43. -----------------------------------------
  44. Lawrence Kirby | fred@genesis.demon.co.uk
  45. Wilts, England | 70734.126@compuserve.com
  46. -----------------------------------------
  47.